<?php
/**
 * WQPHP封装工具类，仅供学习研究使用，禁止任何形式的转载发布
 * User: Jessica@aweb.wang
 * Date: 2023/3/10 14:50
 * Email: <1194323013@qq.com>
 *                            _ooOoo_
 *                           o8888888o
 *                           88" . "88
 *                           (| -_- |)
 *                           O\  =  /O
 *                        ____/`---'\____
 *                      .'  \\|     |//  `.
 *                     /  \\|||  :  |||//  \
 *                    /  _||||| -:- |||||-  \
 *                    |   | \\\  -  /// |   |
 *                    | \_|  ''\---/''  |   |
 *                    \  .-\__  `-`  ___/-. /
 *                  ___`. .'  /--.--\  `. . __
 *               ."" '<  `.___\_<|>_/___.'  >'"".
 *              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
 *              \  \ `-.   \_ __\ /__ _/   .-` /  /
 *         ======`-.____`-.___\_____/___.-`____.-'======
 *                            `=---='
 *        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 *                      Buddha Bless, No Bug !
 **/

namespace app\common\utils;

class ResponseUtils
{
    //返回成功信息
    public static function retSuccess(){
        $resp=json_encode(['code'=>200,'msg'=>'处理成功'],JSON_UNESCAPED_UNICODE);
        return $resp;
    }
    //返回错误信息
    public static function retError($msg){
        $resp=json_encode(['code'=>400,'msg'=>$msg],JSON_UNESCAPED_UNICODE);
        return $resp;
    }
    //返回成功信息并包含数据
    public static function retSuccessWithData($data){
        $resp=json_encode(['code'=>200,'msg'=>'处理成功','data'=>$data],JSON_UNESCAPED_UNICODE);
        return $resp;
    }
    public static function retSuccessWithListData($data){
        $resp=json_encode(['code'=>0,'msg'=>'处理成功','count'=>$data['total'],'data'=>$data['data']],JSON_UNESCAPED_UNICODE);
        return $resp;
    }

}
